const fs = require('fs');
const path = require('path');
const http = require('http');

// 获取文件的绝对路径
const fullPath = path.join(__dirname, '/info.json');
// 读取json文件获取学生数据
const data = fs.readFileSync(fullPath, 'utf-8');
const students = JSON.parse(data);
//console.log(students);

function countAdd(students) {
	// 获取随机数 0-101
	let num = parseInt(Math.random() * students.length);
	console.log(students[num]);
    ++students[num].count;
    fs.writeFileSync(fullPath, `${JSON.stringify(students)}`);
}
countAdd(students);